﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;

namespace LilTmSim
{
	public class StateNodeCollection : ObservableCollection<StateNode>
	{
		public delegate void CollectionAndNode(StateNodeCollection sender, StateNode node);
		public event CollectionAndNode OnItemInserted;
		public event CollectionAndNode OnItemRemoved;
		
		protected override void InsertItem(int index, StateNode item)
		{
			if (OnItemInserted != null)
				OnItemInserted(this, item);
			base.InsertItem(index, item);
		}

		protected override void RemoveItem(int index)
		{
			if (OnItemInserted != null)
				OnItemRemoved(this, this[index]);
			base.RemoveItem(index);
		}
	}
}
